Ext.require(['*']);
Ext.onReady(function(){
	
	Ext.QuickTips.init();  
    Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));

    Ext.create('Ext.Viewport', {
        id: 'border-example',
        layout: 'border',
        items: [
        Ext.create('Ext.Component', {
            region: 'north',
            height: 50,
            autoEl: {
                tag: 'div',
                html:'<h1 style="margin-left:10px">MoYo基础平台  ver 0.1</h1>'
            }
        }), {
            region: 'south',
            items:[],
            split: true,
            height: 100,
            minSize: 100,
            maxSize: 200,
            collapsible: true,
            collapsed: true,
            title: 'South',
            margins: '0 0 0 0'
        }, {
            xtype: 'tabpanel',
            region: 'east',
            title: '属性设置',
            dockedItems: [{
                dock: 'top',
                xtype: 'toolbar',
                items: [ '->', {
                   xtype: 'button',
                   text: '点我',
                   tooltip: '啥米都米有'
                }]
            }],
            animCollapse: true,
            collapsible: true,
            split: true,
            width: 225, // give east and west regions a width
            minSize: 175,
            maxSize: 400,
            margins: '0 5 0 0',
            activeTab: 1,
            tabPosition: 'bottom',
            items: [{
                html: '<p>空白Tab</p>',
                title: '虾米',
                closable: true,
                autoScroll: true
            }, Ext.create('Ext.grid.PropertyGrid', {
                    title: '属性',
                    source: {
                        "名称": "属性表",
                        "分组": false,
                        "自动填充": true,
                        "生产版本": false,
                        "创建时间": Ext.Date.parse('10/15/2006', 'm/d/Y'),
                        "是否测试": false,
                        "版本号": 0.01,
                        "边框宽度": 1
                    }
                })]
        }, {
            region: 'west',
            stateId: 'navigation-panel',
            id: 'west-panel', // see Ext.getCmp() below
            title: '功能菜单',
            split: true,
            width: 200,
            minWidth: 175,
            maxWidth: 400,
            collapsible: true,
            animCollapse: true,
            margins: '0 0 0 5',
            layout: 'accordion',
            items: [{
                items:[
                 Ext.create('Ext.menu.Menu', {
                    width: 175,
                    margin: '0 0 10 0',
                    floating: false,  // usually you want this set to True (default)
                    items: [{
                        text: '数据设置',
                        handler:function(){
                        	Ext.getCmp("mainTabPanel").add({
                        		title:'数据设置',
                        		items:[]
                        	});
                        	Ext.getCmp("mainTabPanel").setActiveTab(1);
                        }
                    },{
                        text: 'regular item 2'
                    },{
                        text: 'regular item 3'
                    }]
                })],
                title: '基础数据',
                iconCls: 'nav' // see the HEAD section for style used
            }, {
                title: 'Settings',
                html: '<p>Some settings in here.</p>',
                iconCls: 'settings'
            }, {
                title: 'Information',
                html: '<p>Some info in here.</p>',
                iconCls: 'info'
            }]
        },
        // in this instance the TabPanel is not wrapped by another panel
        // since no title is needed, this Panel is added directly
        // as a Container
        Ext.create('Ext.tab.Panel', {
        	id:'mainTabPanel',
            region: 'center', // a center region is ALWAYS required for border layout
            deferredRender: false,
            activeTab: 0,     // first tab initially active
            items: [{
                items:[],
                title: '工作面板',
                glyph: 72,
                autoScroll: true
            }]
        })]
    });
	
});